import './Workflow.scss';
import * as React from 'react';
import classnames from 'classnames';


export interface IProps {
    tooltip: string; // 提示文本
    icon: string; // 图标
    onclick: Function; // 点击事件
    type: number; // 类型
    active: boolean; // 是否active
}

export default class WorkflowOperaItem extends React.Component<IProps, any> {
    render() {
        const {tooltip, icon, onclick, type, active} = this.props;
        const className: string[] = ['workflow__toolbarItem'];
        if (active) {
            className.push('active');
        }
        return (
            <div className={classnames(className)} onClick={() => onclick(type)}>
                <div className='workflow__toolbarItem__icon' title={tooltip} >
                    <span className={classnames('iconfont', icon)}></span>
                </div>
                <p className='workflow__toolbarItem__text'>{tooltip}</p>
            </div>
        );
    }
};
